package com.eric.socket;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;

public class MutiThreadServerSocket {
	//存储Socket对象 
    public static ArrayList<Socket> socketList = new ArrayList<>();
	public static void main(String[] args) {
		try {
			ServerSocket ss = new ServerSocket(30010);
			while(true){
				Socket  socket = ss.accept();
			    socketList.add(socket);
			    //每当一个客户端连接之后，就启动一个线程
			    new Thread(new ServerThread(socket)).start();
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	

}
